<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.trkj.com/tr1702/tags" prefix="my" %>
<html>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/default/easyui.css"/>" />
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/icon.css"/>" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>证书</title>
</head>
<body>
<div id="cf-Certificate-panel" style="border:0;margin-top:0px;margin-left:0px;width:100%;height:524px" class="easyui-panel"">
		<script type="text/javascript">
					<my:g id="99"> 
				var formatters =function(value,row,index){
					var edit = "<a butn='tb_btn_edit' onclick='editrow("+row["CERTI_ID"]+")'></a>";
					var del="<a butn='tb_btn_del1' onclick='delrow("+row["CERTI_ID"]+")'></a>";
					return edit+del;
				}
			 
				var delrow=function(CERTI_ID){
					 var vv=$('#cf-Certificate-tb').datagrid('getSelected');
					$.messager.confirm("提示",'确定删除一行',function(v){
						if(v){
						 $.post("Certificate_remove",{certiId:CERTI_ID},function(){
							 $('#cf-Certificate-tb').datagrid('reload');
						 });
						}
					});
				}
					</my:g> 
				$(function(){
					$("#cf-Certificate-tb").datagrid({onLoadSuccess:function(){
						$("a[butn=tb_btn_del1]").linkbutton({iconCls:'icon-cancel', plain:true});
					}});
					//编辑
					$("#cf-Certificate-tb").datagrid({onDblClickRow:function(){
						     $.messager.show({
						    	 	title:'提示消息',
						    		msg:'',
						    		timeout:100,
						    		showType:'show' });
					}});
					//打开
						$("#cf-Certificate-add").linkbutton({onClick:function(){
							 $('#cf-Certificate-panel').panel({
								 href:"login_certificate_add"
								 });
							$('#cf-Certificate-tb').datagrid('reload');
						}});
						$("#cf-Certificate-refresh").linkbutton({onClick:function(){
							$('#cf-Certificate-tb').datagrid('reload');
						}});
				});
		</script>
		<div id="cf-Certificate-tbs12">
		<my:g id="97"> 
   		 <a id="cf-Certificate-add" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true,text:'添加'"></a>
    	 </my:g>
		<a id="cf-Certificate-refresh" class="easyui-linkbutton" data-options="iconCls:'icon-reload',text:'刷新',plain:true,iconAlign:'right'"></a>
    	 <input id="cf-Certificate-searchbox" class="easyui-searchbox" data-options="label:'搜索',width:300,labelWidth:50,prompt:'员工编号、姓名',disabled:true,
     	searcher:function(value,name){
	            $('#cf-Certificate-tb').datagrid('load','Certificate_pages?certiName='+value);
     	 }">
  		</div>
		<table id="cf-Certificate-tb" class="easyui-datagrid" data-options="
			url:'Certificate_pages',
			fitColumns:true,
			fit:true,
			nowrap:false,
			loading:true,
			pagination:true,
			rownumbers:true,
			singleSelect:true,
			pageSize:10,
    		pageList:[5,6,7,8,9,10],
			toolbar:'#cf-Certificate-tbs12',
			striped:true,
			method:'get'	
	">
		<thead>
		  <tr>
			<th data-options="field:'CERTI_ID',width:150,align:'center'">证书编号</th> 
			<th data-options="field:'ZSZL_ID',width:150,align:'center'">证书种类编号</th>
			<th data-options="field:'CERTI_NAME',width:150,align:'center'">证书名称</th>
			<th data-options="field:'CERTI_OWNERTYPE',width:150,align:'center'">拥有者</th>
			<th data-options="field:'CERTI_USESTATE',width:150,align:'center',
			formatter:function(value,row,index){
					if(value==0){
						return value='在库';
					}else{return value='在借';
			}}">使用状态</th>
			<th data-options="field:'CERTI_BORROWSTATE',width:100,align:'center',
			formatter:function(value,row,index){
					if(value==0){return value='过期';}else{return value='正常';}}">借用状态</th>
			<th data-options="field:'CERTI_EFFECTIVEDATE',width:200,align:'center',
			formatter:function(value){
				var date = new Date(value);
                        var y = date.getFullYear();
                        var m = date.getMonth() + 1;
                        var d = date.getDate();
                        return y + '-' +m + '-' + d;
			}">有效日期</th>
			<th data-options="field:'CERTI_PERSON',width:200,align:'center'
			,styler:function(value,row,index){
					if(value==1){
						return 'color:red;';
					}else{return 'color:#000000';}
				}">颁发人</th>
			<th data-options="field:'9',width:50,align:'center',formatter:formatters">操作</th>
		  </tr>	
		</thead>
		<tbody>
		</tbody>
	</table>
<div>
</body>
</html>